
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 2555. -- SubString -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>2555: SubString</h2><span class=green>Time Limit: </span>30 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>512 MB<br><span class=green>Submit: </span>3&nbsp;&nbsp;<span class=green>Solved: </span>2<br>[<a href='submitpage.php?id=2555'>Submit</a>][<a href='problemstatus.php?id=2555'>Status</a>][<a href='bbs.php?id=2555'>Discuss</a>]</center><h2>Description</h2><div class=content><p><span style="font-size: medium">&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;懒得写背景了，给你一个字符串init，要求你支持两个操作<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;(1):在当前字符串的后面插入一个字符串<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;(2):询问字符串s在当前字符串中出现了几次？(作为连续子串)<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;你必须在线支持这些操作。<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span></p></div><h2>Input</h2><div class=content><p><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;第一行一个数Q表示操作个数<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;第二行一个字符串表示初始字符串init<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;接下来Q行，每行2个字符串Type,Str <br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Type是ADD的话表示在后面插入字符串。<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Type是QUERY的话表示询问某字符串在当前字符串中出现了几次。<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;为了体现在线操作，你需要维护一个变量mask，初始值为0<br />
&nbsp;&nbsp;&nbsp;<br />
<img height="266" alt="" width="568" src="/JudgeOnline/upload/201112/11.JPG" />&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;读入串Str之后，使用这个过程将之解码成真正询问的串TrueStr。<br />
&nbsp;&nbsp;&nbsp;&nbsp;询问的时候，对TrueStr询问后输出一行答案Result<br />
&nbsp;&nbsp;&nbsp;&nbsp;然后mask = mask xor Result&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;插入的时候，将TrueStr插到当前字符串后面即可。<br />
&nbsp;&nbsp;&nbsp;</font></p></div><h2>Output</h2><div class=content></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>    2<br />
<br />
    A<br />
 <br />
    QUERY B<br />
<br />
    ADD BBABBBBAAB<br />
<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata>   <br />
    0<br />
</span></div><h2>HINT</h2>
			<div class=content><p><p><font size="4">&nbsp;40 % 的数据字符串最终长度 &lt;= 20000，询问次数&lt;= 1000，询问总长度&lt;= 10000<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />
&nbsp;&nbsp;&nbsp;&nbsp;100 % 的数据字符串最终长度 &lt;= 600000，询问次数&lt;= 10000,询问总长度&lt;= 3000000<br /><br />
&nbsp;&nbsp;&nbsp;<br /><br />
</font></p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search=Ctsc模拟赛By 洁妹'>Ctsc模拟赛By 洁妹</a></p></div><center>[<a href='submitpage.php?id=2555'>Submit</a>][<a href='problemstatus.php?id=2555'>Status</a>][<a href='bbs.php?id=2555'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
